From e09f2b8b56d954a01bd2ff7cac366a41661979ab Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 6 Jan 2020 17:36:18 -0500 Subject: [PATCH] entry: Use gdk_drag_begin Use gdk_drag_begin for one-off drags. --- gtk/gtkentry.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 4ec8a0f375..b5d367a9c1 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -69,6 +69,7 @@ #include "gtknative.h" #include "gtkgestureclick.h" #include "gtkdragsource.h" +#include "gtkdragicon.h" #include "gtkwidgetpaintable.h" #include "a11y/gtkentryaccessible.h" @@ -1464,20 +1465,22 @@ icon_drag_update_cb (GtkGestureDrag *gesture, if (icon_info->content != NULL && gtk_drag_check_threshold (icon_info->widget, start_x, start_y, x, y)) { - GtkDragSource *source; GdkPaintable *paintable; + GdkSurface *surface; GdkDevice *device; + GdkDrag *drag; icon_info->in_drag = TRUE; - source = gtk_drag_source_new (); - gtk_drag_source_set_content (source, icon_info->content); - gtk_drag_source_set_actions (source, icon_info->actions); + + surface = gtk_native_get_surface (gtk_widget_get_native (GTK_WIDGET (entry))); + device = gtk_gesture_get_device (GTK_GESTURE (gesture)); + + drag = gdk_drag_begin (surface, device, icon_info->content, icon_info->actions, start_x, start_y); paintable = gtk_widget_paintable_new (icon_info->widget); - gtk_drag_source_set_icon (source, paintable, -2, -2); + gtk_drag_icon_set_from_paintable (drag, paintable, -2, -2); g_object_unref (paintable); - device = gtk_gesture_get_device (GTK_GESTURE (gesture)); - gtk_drag_source_drag_begin (source, GTK_WIDGET (entry), device, start_x, start_y); - g_object_unref (source); + + g_object_unref (drag); } } -- 2.30.2